Skip to content

feat(transport/requests): RequestsHTTPTransport execute func add extra_args param #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 23, 2021

Conversation

ma-pony
Copy link
Contributor

@ma-pony ma-pony commented Aug 22, 2021

RequestsHTTPTransport execute function support input headers.
like this

result = client.execute(
    query, extra_args={"headers": {"authorization": "xxx-123"}}
)

@ma-pony ma-pony changed the title feat(transport/request): requestTransport execute func add extra_args param feat(transport/request): RequestsHTTPTransport execute func add extra_args param Aug 22, 2021
@ma-pony ma-pony changed the title feat(transport/request): RequestsHTTPTransport execute func add extra_args param feat(transport/requests): RequestsHTTPTransport execute func add extra_args param Aug 22, 2021
@codecov-commenter
Copy link

codecov-commenter commented Aug 22, 2021

Codecov Report

Merging #232 (f1f806d) into master (20ae2e2) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #232   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           16        16           
  Lines         1137      1139    +2     
=========================================
+ Hits          1137      1139    +2     
Impacted Files Coverage Δ
gql/transport/requests.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20ae2e2...f1f806d. Read the comment docs.

@leszekhanusz
Copy link
Collaborator

leszekhanusz commented Aug 22, 2021

Are you aware that you can already set headers with RequestHTTPTransport using the headers argument of the transport ?

Copy link
Collaborator

@leszekhanusz leszekhanusz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except some minor cosmetic requests (newlines)

@ma-pony
Copy link
Contributor Author

ma-pony commented Aug 23, 2021

Are you aware that you can already set headers with RequestHTTPTransport using the headers argument of the transport ?

yes, I know it.
but my case like

transport = RequestTransport(url=url)
client = Client(transport=transport)

user_a_token = client.execute(user_a_login_gql)
user_a_book = client.execute(
    user_a_book_gql, 
    extra_args={"headers": {"authorization": "user_a_token"}}
)

user_b_token = client.execute(user_b_login_gql)
user_b_book = client.execute(
    user_b_book_gql, 
    extra_args={"headers": {"authorization": "user_b_token"}}
)

...

@leszekhanusz leszekhanusz merged commit b7d8150 into graphql-python:master Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants